import React, { useCallback, useEffect, useState, useMemo } from 'react';
import { Table } from 'antd'
import MainTitle from '../../components/MainTitle'
import request from '@/utils/request'
import { connect } from 'react-redux';
import Records from './Records'
import { withStudent } from "@/utils/hoc"
function Clean(props) {
    const [data, setData] = useState([])
    const getData = useCallback((data) => {
        setData(data)
    }, [])
    const columns = useMemo(() => {
        return (
            [
                {
                    title: '姓名',
                    dataIndex: 'userName',
                },
                {
                    title: '日期',
                    dataIndex: 'date',
                },
                {
                    title: '时间',
                    dataIndex: 'time',
                }
            ]
        )
    }, [])
    return (
        <div className="record">
            <MainTitle>个人记录</MainTitle>
            <Records {...props} type="clean" getData={getData}></Records>
            <MainTitle>打扫历史记录</MainTitle>
            <Table columns={columns} dataSource={data} style={{ marginTop: 40 }} />
        </div>
    )
}
Clean = withStudent(Clean)
export default connect(state => ({ userInfo: state.userInfo }))(Clean)